﻿@page
@model AdminUI.Pages.Dialog.SelectAuthorizeMenusModel
@{
    ViewData["Title"] = "选择用户Demo";
}

@section body {

    <f:Panel ID="Panel1" ShowBorder="false" ShowHeader="false" BodyPadding="10" Layout="Fit" IsViewPort="true">
        <Toolbars>
            <f:Toolbar ID="Toolbar1">
                <Items>
                    <f:Button ID="btnClose" Icon="SystemClose" Text="关闭">
                        <Listeners>
                            <f:Listener Event="click" Handler="F.activeWindow.hide();"></f:Listener>
                        </Listeners>
                    </f:Button>
                    <f:Button ID="btnSubmit" Text="确定" Icon="SystemSave" OnClick="@Url.Handler("BtnSubmit_Click")"
                              OnClickParameter1="@(new Parameter("selectedIDs","getCheckedNodeIDs()"))"
                              OnClickParameter2="@(new Parameter("roleID",Model.RoleID.ToString()))"></f:Button>
                </Items>
            </f:Toolbar>
        </Toolbars>
        <Items>
            <f:Tree ID="Tree1" IsFluid="true" MinHeight="400" ShowHeader="false" ShowBorder="false" EnableCheckBox="true" Expanded="true" EnableSingleClickExpand="true"
                    CascadeCheck="true" Nodes="@(TreeNode[])ViewBag.TreeMenuNodes" HeaderStyle="false">
            </f:Tree>
        </Items>
    </f:Panel>


}

@section script {

    <script>
        function getCheckedNodeIDs() {
            var ids = [];

            var checkedNodes = F.ui.Tree1.getCheckedNodes(true);
            if (checkedNodes.length) {
                $.each(checkedNodes, function (index, node) {
                    ids.push(node.id);
                });
            }

            return ids;
        }
    </script>

}
